<?php

/**
 * Cadformacao form base class.
 *
 * @method Cadformacao getObject() Returns the current form's model object
 *
 * @package    SCBE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCadformacaoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idformacao'       => new sfWidgetFormInputHidden(),
      'idpessoa'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpessoa'), 'add_empty' => false)),
      'idnivelformacao'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadnivel'), 'add_empty' => false)),
      'nomecurso'        => new sfWidgetFormInputText(),
      'iescurso'         => new sfWidgetFormInputText(),
      'idareaformacao'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadareaformacao'), 'add_empty' => false)),
      'datainiciocurso'  => new sfWidgetFormDate(),
      'dataterminocurso' => new sfWidgetFormDate(),
      'idcidadeformacao' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidade'), 'add_empty' => true)),
      'idpaisformacao'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpais'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'idformacao'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idformacao')), 'empty_value' => $this->getObject()->get('idformacao'), 'required' => false)),
      'idpessoa'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpessoa'))),
      'idnivelformacao'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadnivel'))),
      'nomecurso'        => new sfValidatorString(array('max_length' => 45)),
      'iescurso'         => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'idareaformacao'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadareaformacao'))),
      'datainiciocurso'  => new sfValidatorDate(array('required' => false)),
      'dataterminocurso' => new sfValidatorDate(array('required' => false)),
      'idcidadeformacao' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidade'), 'required' => false)),
      'idpaisformacao'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpais'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cadformacao[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cadformacao';
  }

}
